struct Solution {}

fn main() {}

impl Solution {
    pub fn array_pair_sum(nums: Vec<i32>) -> i32 {
        let mut nums_cp = nums.clone();
        nums_cp.sort();
        let mut sum = 0;
        for i in 0..nums_cp.len() {
            if i % 2 == 0 {
                sum += nums_cp[i];
            }
        }
        sum
    }
}